# Importing Data
CANADA<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "I1:I264")

# Checking the Imported Data
View(CANADA)
# Creating Time Series Data
CANADA_ts <- ts(CANADA, start=c(1998,1), end=c(2018,12), frequency=12)
# Viewing and Checking the Created Time Series Data
CANADA_ts
sum(is.na(CANADA_ts))
library(forecast)
CANADA_ts <- tsclean(CANADA_ts)
CANADA_ts

# Identification: Plotting the Time Series Data
plot(CANADA_ts)

# Estimating the appropriate model
CANADA_ts_model <- auto.arima(CANADA_ts)
CANADA_ts_model

# Forecasting
options(max.print=1000000)
CANADA_ts_forecast <- forecast (CANADA_ts_model, level=c(95), h=364)
plot(CANADA_ts_forecast)
CANADA_ts_forecast             

# Exporting
write.table(CANADA_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/CANADA_TSA.csv", sep=",")
